//
//  DYGJGCell.m
//  TerritoryShopkeeper
//
//  Created by 黄德玉 on 2018/6/22.
//  Copyright © 2018年 ZDQK. All rights reserved.
//

#import "DYGJGCell.h"
#import <Masonry/Masonry.h>
#import "DYGJGModel.h"
#import <SDWebImage/UIButton+WebCache.h>

@interface DYGJGCell()
@property (nonatomic,strong) UIButton * btn;
@property (nonatomic,strong) UILabel * titleLabel;
@end

@implementation DYGJGCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
//        self.backgroundColor = [UIColor lightGrayColor];
        self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:self.btn];
        [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(self);
            make.width.equalTo(@63);
            make.height.equalTo(@63);
        }];
        self.titleLabel = [UILabel new];
        self.titleLabel.font = [UIFont systemFontOfSize:12];
        self.titleLabel.textColor = [UIColor darkTextColor];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
//        self.titleLabel.text = @"没过关";
        [self addSubview:self.titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
        }];
    }
    return self;
}

- (void)loadData:(id)dat{
    DYGJGModel * model = [DYGJGModel mj_objectWithKeyValues:dat];
    self.titleLabel.text = model.cname;
    NSURL * utf8Str = [model.cicon mj_url];
    [self.btn sd_setImageWithURL:utf8Str forState:UIControlStateNormal];
}

@end
